#include "stm32f10x.h"                  // Device header
#include "Delay.h"
#include "led.h"
#include "key.h"
#include "OLED.h"
#include "CountSensor.h"
#include "Timer.h"
#include "PWM.h"
#include "Servo.h"
#include "ADC.h"
int main()
{
	OLED_Init();
	AD_Init_ContinuousConvMode(RCC_APB2Periph_ADC1, RCC_APB2Periph_GPIOA, GPIOA, GPIO_Pin_0, RCC_PCLK2_Div6, ADC1, ADC_Channel_0, 1, ADC_SampleTime_55Cycles5, 
	ADC_Mode_Independent, ADC_DataAlign_Right, ADC_ExternalTrigConv_None);
	uint16_t AD_Value;
	float Volatge;
	while(1)
	{
		AD_Value = AD_GetValue_ContinuousConvMode(ADC1, ADC_FLAG_EOC);
		Volatge = (float)AD_Value / 4095 *3.3;
		OLED_ShowNum(1,1,AD_Value,4);
		OLED_ShowNum(2,1,Volatge,1);
		OLED_ShowNum(2,3,(uint16_t)(Volatge * 100) % 100, 2);
		OLED_ShowChar(2,2,'.');
		Delay_ms(100);
	}
}
